<?php
require('../../s/comm/config.php');
require("../common/connect.php");
$content = "[MallData]\r\nv=1\r\nt=".date("Y-m-d H:i:s")."\r\nc=";

$sql="select * from ".$BIAOTOU."mall where sort > 0 order by sort desc";
$rs = mysql_query($sql);
$content .= mysql_num_rows($rs);
$content .= "\r\n";
$i = 1;
while ($row = mysql_fetch_array($rs))
{
	$content .= "m".$i++."=";
	$content .=$row["name"] . "|";
	
	$url = str_replace("http://www","", $row["url"]);
	$url = str_replace("http://","", $url);
	$end = strpos($url, "/");
	$url = substr($url, 0, $end ? $end : strlen($url));
//	$url = str_replace("www.",".", $row["url"]);
	$content .= $url. "|";
	if ($row["client_fx_desc"] == "")
		$content .= "单笔订单 <font color='0xff0000'>最高可返 ".$row["fan"] . "</font>|";
	else
		$content .= $row["client_fx_desc"]."|";
		
	$content .= "http://www.gouwutu.com/new/mall/mall.php?id=" . $row["id"];
	
	// add by 2012-2-1 collin
	$content .= "|";
	$content .= $row["merchant"] . "|";
	
	if($row["lm"]=='linktech')
	    $content .= "http://click.linktech.cn/?m=".$row['merchant']."&a=".MALLWZBH."&l=99999&l_cd1=0&l_cd2=1&tu=".urlencode($row['url'])."&u_id=";
	else if($row['lm']=='yiqifa')
	    $content .= $row['yilink'];	
	
	$content .= "\r\n";
}
$content = iconv("UTF-8", "gb2312", $content);
//$content = substr($content,3);
file_put_contents('temp/get_mall_data.dat', $content);
?>